package com.extremeforce.parser;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import org.jdom.Element;

public class SalesInfoParser extends IGuangXMLParser{
	
	@Override
	public ArrayList<HashMap<String,String>> process(Element records){
		
		ArrayList<HashMap<String,String>> list = new ArrayList<HashMap<String,String>>();
		List<Element> recordList = records.getChildren("RECORD");
		for(Iterator<Element> iter = recordList.iterator();iter.hasNext();){
			
			Element record = (Element)iter.next();
			String GOODS_ID = record.getChildText("GOODS_ID");
			String SHOP_ID = record.getChildText("SHOP_ID");
			String START_TIME = record.getChildText("START_TIME");
			String END_TIME = record.getChildText("END_TIME");
			String GOODS_DISCOUNT = record.getChildText("GOODS_DISCOUNT");
			String GOODS_NUM = record.getChildText("GOODS_NUM");
			String SALES_TYPE = record.getChildText("SALES_TYPE");
			
			HashMap<String,String> map = new HashMap<String,String>();
			map.put("GOODS_ID",GOODS_ID);
			map.put("SHOP_ID",SHOP_ID);
			map.put("START_TIME",START_TIME);
			map.put("END_TIME",END_TIME);
			map.put("GOODS_DISCOUNT",GOODS_DISCOUNT);
			map.put("GOODS_NUM",GOODS_NUM);
			map.put("SALES_TYPE",SALES_TYPE);
			
			list.add(map);
		}
		return list;
	}
}
